import logging
from redis import StrictRedis
class Config(object):
    #项目下的环境配置
    DEBUG = True
    SECRET_KEY = "iSHGsQ7uVapOF/7wNjAaACoo+FVQJTMIESUJvSW3emjrhOMHlZKUM8qStknihLtD"
    #为数据库添加配置
    SQLALCHEMY_DATABASE_URI = "mysql+mysqlconnector://root:7474741xx@127.0.0.1:3306/information27"
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    #redis数据库的配置
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379

    #sessio保存配置
    SESSION_TYPE = "redis"
    #开启session签名
    SESSION_USE_SIGNER = True
    #指定session保存的redis
    SESSION_REDIS = StrictRedis(host= REDIS_HOST,port=REDIS_PORT)
    #设置需要过期
    SESSION_PERMANENT = False
    #设置过期时间
    PERMANENT_SESSION_LIFETIME = 86400 * 2

    #设置日志等级
    LOG_LEVEL = logging.ERROR

class Development(Config):
    DEBUG = True

class Production(Config):
    #生产环境下的配置
    DEBUG = False
    LOG_LEVEL = logging.WARNING

class Testing(Config):
    DEBUG = True
    TESTING = True

config = {
    "Development":Development,
    "Production":Production,
    "Testing":Testing
}